package cn.itcast.shop.adminuser.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import cn.itcast.shop.adminuser.vo.AdminUser;

public class AdminUserDao extends HibernateDaoSupport {

	/**
	 * 根据用户名密码查找用户
	 * @param adminUser
	 * @return
	 */
	public AdminUser login(AdminUser adminUser) {
		String hql = "from AdminUser where username=? and password=?";
		@SuppressWarnings("unchecked")
		List<AdminUser> list =  this.getHibernateTemplate().find(hql,adminUser.getUsername(),adminUser.getPassword());
		if (list!=null&&list.size()>0) {
			return list.get(0);
		}
		return null;
	}
	
}
